#pragma once

#include <functional>
#include <vector>
#include <string>

typedef std::function<void(int, const std::string&, uint16_t, const std::string&)> func;
//int serverSock, const std::string& IP, uint16_t port
class Task
{
public:
    Task(){}

    Task(func fun, int sockfd, const std::string& IP, uint16_t port)
        : _fun(fun)
        , _sockfd(sockfd)
        , _IP(IP)
        , _port(port)
    {}

    void operator()(const std::string& name)
    {
        // 执行任务
        _fun(_sockfd, _IP, _port, name);
    }

public:
    func _fun;
    int _sockfd;
    std::string _IP;
    uint16_t _port;
};
